import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class CalculatorMain {

	public static void main(String[] args) throws IOException {

		InputFunction IF = new InputFunction();
		CalculatorFunction CF = new CalculatorFunction();
		OutputFunction OF = new OutputFunction();

		while (true) {
			BufferedReader inputLine = new BufferedReader(
					new InputStreamReader(System.in));
			String userInputText = null;
			userInputText = inputLine.readLine();

			if (userInputText.equals("0")) {
				break;
				
			} else {
				IF.inputText(userInputText);
				CF.calculation();
				OF.outputFunction();
			}
		}

	}

}
